﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>删除节点</title>
</head>
<body>
    <ul id="myList"><li>咖啡</li><li>红茶</li><li>牛奶</li></ul>
    <p id="demo">单击按钮移除列表的第一项，从而完成删除节点操作</p>
    <button onclick="myFunction()">删除节点</button>
    <script>
        function myFunction() {
            var list = document.getElementById("myList");
            list.removeChild(list.childNodes[0]);
        }
    </script>
</body>
</html>